<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 1. Number.EPSILON 是js表示的最小精度
        console.log(Number.EPSILON) // 2.220446049250313e-16
        console.log(0.1 + 0.2)
        console.log(0.1 + 0.2 === 0.3)

        // 2. 二进制、八进制、十六进制
        let b = 0b1010
        let o = 0o7777
        let x = 0xFF
        console.log(b)
        console.log(o);
        console.log(x);

        // 3. Number.isFinite 检测是否十一个有限数
        console.log(Number.isFinite(100)) // true
        console.log(Number.isFinite(1/3)) // true
        console.log(Number.isFinite(100/0)) // false
        console.log(Number.isFinite(NaN))   // false
        console.log(Number.isFinite(Infinity)) // false

        // 4. Number.isNaN 检测数值是否是NaN
        console.log(Number.isNaN(0)) // false
        console.log(Number.isNaN(-1)) // false
        console.log(Number.isNaN(1/3)) // false
        console.log(Number.isNaN(Infinity)) // false
        console.log(Number.isNaN(NaN)) // true

        // 5. Number.parseInt Number.parseFloat
        console.log(Number.parseInt('-1string1')) // -1
        console.log(Number.parseFloat('0.98string3')) // 0.98

        // 6. Number.isInteger 判断是否是整数
        console.log(Number.isInteger(5)) // true
        console.log(Number.isInteger(-2.67)) // false

        // 7. Math.trunc 将数字的小数部分抹掉
        console.log(Math.trunc(0.23)) // 0

        // 8. Math.sign 判断负数、零、正数
        console.log(Math.sign(10)) // 1
        console.log(Math.sign(0))  // 0
        console.log(Math.sign(-10)) // -1
    </script>
</body>
</html>